package org.nepu.srr.domain.equipmentdata.converter;

import cn.hutool.json.JSONUtil;
import org.nepu.srr.domain.equipmentdata.vo.CommonInputPlus;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class CommonInputPlusConverter implements AttributeConverter<CommonInputPlus, String> {
    @Override
    public String convertToDatabaseColumn(CommonInputPlus commonInputPlus) {
        return JSONUtil.toJsonStr(commonInputPlus);
    }

    @Override
    public CommonInputPlus convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, CommonInputPlus.class);
    }
}
